﻿<?php
	include '../inc/conn.php';
	
	session_start();	

	extract($_POST);
	extract($_GET);
	unset($_POST,$_GET);
	if (isset($act) && isset($id))
	{
		if ($act == "del"){
			$db = new mysql();
			$db->delete('eng_version_control_table', "id=".$id);
			$db->close();
			echo "<script>alert('Data has deleted!!!');window.location='admin_index.php?name=version';</script>";
		}
	}
?>
<div class="container-fluid">
<? if ($_SESSION['user'] != 1){  
	echo '<script>window.location="userinfo.php"</script>';
 } else {
?>
<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">管理面板>>个人绩效</h3>
    </div>
    <div class="panel-body">
	<div><?echo date("Y"); ?>年</div>
	<div>
		<table border=0 cellpadding=0 class="table table-striped">
		<tr class="success"><th>Item</th><th>姓名</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th></tr>
<?
		$db = new mysql();
		$db->query("select * from users where enable=1");
		$num = $db->db_num_rows();
		for($i=0; $i<$num; $i++){
			$row = $db->fetch_assoc();
			$item = $i + 1;
			echo "			<tr>";
			echo "<td>$item</td>";
			echo "<td>".$row['chn_name']."</td>";
			for($m=1; $m<=12; $m++){
				$db1 = new mysql();
				$db1->connect();
				$db1->query("select KPI_total from eng_kpi where UID=".$row['ID']." and KPI_month=".$m);
				$num1=$db1->db_num_rows();
				if ($num1 >= 1){
					$row1 = $db1->fetch_assoc();
					echo "<td><a href='#' onclick=\"javascript:window.open('mod_kpi.php?id=".$row['ID']."&imonth=$m&ivalue=".$row1['KPI_total']."','绩效', 'height=150, width=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');\">".$row1['KPI_total']."</a></td>";
				}else{
					echo "<td><a href='#' onclick=\"javascript:window.open('add_kpi.php?id=".$row['ID']."&imonth=$m','绩效', 'height=150, width=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');\">+</a></td>";
				}
				$db1->close();
			}
			echo "</tr>\n";
		}
?>
		</table>
	</div>
</div>
</div>
</div>
<? 
}
	$db->close();
?>
